/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package fanta.framework.persistence;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author alessandro
 */
@Entity
@Table(name = "voti")
@NamedQueries({
    @NamedQuery(name = "Voti.findAll", query = "SELECT v FROM Voti v"),
    @NamedQuery(name = "Voti.findById", query = "SELECT v FROM Voti v WHERE v.id = :id"),
    @NamedQuery(name = "Voti.findByVoto", query = "SELECT v FROM Voti v WHERE v.voto = :voto")})
public class Voti implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "voto")
    private double voto;
    @JoinColumn(name = "idgiocatore", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Giocatore idgiocatore;
    @JoinColumn(name = "data", referencedColumnName = "data")
    @ManyToOne(optional = false)
    private DateGiornate data;

    public Voti() {
    }

    public Voti(Integer id) {
        this.id = id;
    }

    public Voti(Integer id, double voto) {
        this.id = id;
        this.voto = voto;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public double getVoto() {
        return voto;
    }

    public void setVoto(double voto) {
        this.voto = voto;
    }

    public Giocatore getIdgiocatore() {
        return idgiocatore;
    }

    public void setIdgiocatore(Giocatore idgiocatore) {
        this.idgiocatore = idgiocatore;
    }

    public DateGiornate getData() {
        return data;
    }

    public void setData(DateGiornate data) {
        this.data = data;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Voti)) {
            return false;
        }
        Voti other = (Voti) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "fanta.framework.persistence.Voti[id=" + id + "]";
    }

}
